/**
 * Implementacion de la clase MapElement.
 */

#include "mapElement.hpp"


void MapElement::setLogger(Logger *logger)
{
	this->logger = logger;
}

Logger* MapElement::getLogger()
{
	return this->logger;
}

std::string MapElement::getId()
{
	return this->id;
}

void MapElement::setId(std::string id)
{
	this->id = id;
}

MapElementType MapElement::getMapElementType()
{
	return this->type;
}

void MapElement::setMapElementType(MapElementType t)
{
	this->type = t;
}

int MapElement::getPositionX()
{
	return this->positionX;
}

int MapElement::getPositionY()
{
	return this->positionY;
}

std::string MapElement::getImageSource()
{
	return this->imageFilename;
}

int MapElement::getImageWidth()
{
	return this->imageSize.width;
}

int MapElement::getImageHeight()
{
	return this->imageSize.height;
}


void MapElement::setPositionX(int x)
{
	this->positionX = x;
}

void MapElement::setPositionY(int y)
{
	this->positionY = y;
}

void MapElement::setImageSource(std::string src)
{
	this->imageFilename = src;
}

void MapElement::setImageWidth(int w)
{
	this->imageSize.width = w;
}

void MapElement::setImageHeight(int h)
{
	this->imageSize.height = h; 
}

int MapElement::comparePositionX(MapElement *me)
{
	return (this->getPositionX() - me->getPositionX());
}

int MapElement::comparePositionY(MapElement *me)
{
	return (this->getPositionY() - me->getPositionY());
}

int MapElement::operator==(MapElement &original){
    //Dos objetos se consideran iguales cuando el id es el mismo
    return (this->getId() == original.getId());
}

int MapElement::operator!=(MapElement &original){
    return (this->getId() != original.getId());
}

int MapElement::operator<(MapElement &original){
    return (this->getId() < original.getId());
}

int MapElement::operator>(MapElement &original){
    return (this->getId() > original.getId());
}

int MapElement::operator<=(MapElement &original){
    return (this->getId() <= original.getId());
}

int MapElement::operator>=(MapElement &original){
    return (this->getId() >= original.getId());
}

BifurcationOption MapElement::reverseOption(BifurcationOption opt)
{
	switch(opt){
		case LEFT:
			return RIGHT;
			break;
		case RIGHT:
			return LEFT;
			break;
		case UP:
			return DOWN;
			break;
		case DOWN:
			return UP;
			break;
	}
}